]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shellInfo: Don't destroy source on undo
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 8 Jul 2021 17:23:38 +0000 (19:23 +0200)
committerMarge Bot <marge-bot@gnome.org>
Tue, 13 Jul 2021 12:38:51 +0000 (12:38 +0000)
Destroying the source from an action callback will result in the
notification being destroyed twice:

 - source.destroy() destroys all its notifications

 - a notification destroys itself after an action
   was activated

This results in unwanted log spam when attempting to dispose the
notification for a second time.

There is actually no good reason for destroying the source explicitly,
as sources already self-destruct with their last notification.

https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4457

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1908>

js/ui/overview.js

index 529779ea8b4fc6f014ddc184d8867943c3b8d5d7..c71b113898c129cb625d8f6268714e89f71e7158 100644 (file)
@@ -25,16 +25,6 @@ var OVERVIEW_ACTIVATION_TIMEOUT = 0.5;
 var ShellInfo = class {
     constructor() {
         this._source = null;
-        this._undoCallback = null;
-    }
-
-    _onUndoClicked() {
-        if (this._undoCallback)
-            this._undoCallback();
-        this._undoCallback = null;
-
-        if (this._source)
-            this._source.destroy();
     }
 
     setMessage(text, options) {
@@ -64,9 +54,8 @@ var ShellInfo = class {
             notification.update(text, null, { clear: true });
         }
 
-        this._undoCallback = undoCallback;
         if (undoCallback)
-            notification.addAction(_("Undo"), this._onUndoClicked.bind(this));
+            notification.addAction(_('Undo'), () => undoCallback());
 
         this._source.showNotification(notification);
     }